Fixes bug reading and writing inheritance