Db #120 repair master relations

Issue #120, Please review and if there are more problems please say.