fix function.apply() call in retry logic