adding scheduled task and fix tests