Fixing legacy error handling