fixed end of limit bug