Fixed some bugs related to commands.