fixing some small functions for checking casts and types