updated rebuild script for nc db for pgs to do it properly