fixes #276: fixes the bug that there are too many rebuilds