Fixed err handling