fix 5 issues pointed out in Rajan's email