BUG: fixed minor bugs pointed out by Jyani