fixed leak when creating commands