added a limit to avoid too long tasks