check if action is legal