Removed exit calls in error functions for robustness