error handling tweaks