error checking tweaks