Fix select loop