fixed issue with interval calculation