Fixed shift duration calculation

Fixes issue #136