Fixed a bug when usign duration as a function directly
added a unit test for the duration as a function bug
build 19