Removed break statements from the error function