fixed some bad castings, more prototypes