fixed some logic in gm commands code