fix problem with image upload (image view page gets 8081 port with the omission of uri->relative()).
fix query so reps are connected to plots.