fixed commandhandler, added synchronized to every function