Fix undefined index on select