fix a few small things found by using sparse