Catching up on bugfixes

These were all pushed to bitbucket earlier but thought I'd bring them where they actually belong...