fix tests and cleanup parse primitive number code