improved memory management in select response