Bug/hanging rebuild

Fix looping rebuilds