select box dynamically selects correct option