refactor populate task
fix tests