[1.2.5] Test case for #1683 + bug fixes

Bugs fixed:
  * #1624 
  * #1723