Code review action - fix incorrect logic and adding missing GL error check