Fix for #105 up-to-date targets will cause premature termination

Added regression test too