assorted bug fixes
( I'm making a merge request to check test result and for people to comment, but I plan to rebase and commit without merge since they are not related )
( I'm making a merge request to check test result and for people to comment, but I plan to rebase and commit without merge since they are not related )