Sanitize

Remove undefined behavior from a couple of places, and remove redundant copy of base_unit.h.

@miguelportilla @rec