define db vars outside of class

+bug fixes