Fix bug with zero sized casts