Fix #395 and #396, OAuth bugs related to saving to DB