minor changes and casts