Add a size function, and fix an exposed bug