wrapping task array in mutex, fixes #2