tweaks error handling