Bugfix Semaphore error check