Make the select loop execute properly