First changes towards support for casts