Fixed bug in limit()