fix next error check