fixed selection bug on code