fix bug where select closes immediately