added err first to some calls