-fixed a few minor bugs found in push #fa6a2d4c05