fixed the limit function