add modifications from @Jingping per email on Sep/2/2014