jh - fixed a few minor bugs