fix Duration endless recursion and setting on error, add tests