bug fixes in relations code; add back default deleteAttribute; less debug output; optimisations