Fixes on #22 and a few other