fixing more problems about casts