fix err nil checking logic