Fixed issues with directory cleaning/re-building