Fixed a bug that caused commands to be executed twice.