fixed Database Query problem