Fix crash due to incorrect array initialization.
Fixed crash due to incorrect allocation of NSDate. Fixed some logical errors from the OS X 10.8 update.
Fixed a leak.
Fixed regression with OSX 10.8 update due to incorrect use of dispatch_semaphore_wait return value.