fixed possible exception in GiveCommand