handle correctly cases where there is no previous or next keyframe