Fix wrong inheritance code