Changed DB sessions to avoid mysql server has gone away.