handle unexpected error when compiling