bug fixes in qlearning