Fix insets

Class seems unnecessarily specialized, the same code could read/write any object, perhaps using a generic type to avoid casting.