updated select command to work