fixed some small logic errors xt.databse