Fixing issue with mapping events to commands