Fixed bug in  #596