fixed selection loop