moving the SQL stuff away from the Member constructor and fixing some broken unit tests

Do not merge it yet for the love of the FSM!