Refactor to automatic update work properly.