Possible type safety fixes