changed the sync and patch script to hopefully do all the dirty work beforehand.