fixed bug in semaphore code where it wouldn't work right, period.