fix a few minor bugs