fixed database selection bug