Fixed db connection overflow bug