minor error checking addition