Fix bug where collections of primitives would result in an exception