more fixes for cast