fixed errors when running with --race