bugfixes and moved procedures saving over to mike's new autorelations method