Fixes error check