error handling tweaks + misc