A bunch of fixes, please review