Fixes scheduled scan and scan agent task
Merge commit 'e68130d7a16c7a74acddbfc8f90fdb6a30881a0d' into HEAD