fixed two bugs introduced while adding version 1 code