fixed some casts