fixed the incorrect casting of *error