fixed issue #211 and  #203