Release semaphore when waiting for internal concurrent threads
Better error about illegal outputs