vlad's revision
fixed the endpoint bug