Remove unused dbapi code and fixed tests