Better null handling

still need to address precision loss in a few places