Fix $err handling