Corrected the error check..