Fixed memory issue on commands