some bugfixes on select