Fixed bugs reported by Dinesh