corrected bug created with new error handling logic