Error checking

Small error checking