Handled NULL in limit function