fixing synchronized tasks when using ssl and when using a task function