fix castign bug