fixed bug in command handling