invert instanceof check of LastErrorException to make slightly cleaner and more copy-paste friendly. patch by jbellis