Bug fix: the end marker was not being set correctly.