select function was wrongly indented