fix semaphores problems
fix qlearning