Add additional error checking