error checking works