fixed unit and functional tests for Issue #613

Fixed two unit tests and ~35 functests for last minute modification in  PR #613