cleaned up unnecessary check for *error != NULL