Fixed database stuff because I wasn't smart enough to close the
connections