Added validation to commands before sending it to the APM