Revert "Revert "fixed bug in autoupdate""

This reverts commit a4de0910d0964d00a6f5348200d6ab2b041a2435.