Fix #696 issue, final - added tests