Error Handling Fix

Wrong error was reported. This has been fixed.