fixed edge case which produced negative marker index