Error checking, minor crash "fixes"

This needs a real overhaul.