Made almost working sync script
Fixed build of materials tree