Fixed error in error handling.