Fixed (probably) DB bugs