ignore errors when selecting section

fixes problem when there is no sections
use string-to-number instead of string-to-int

fixes compiler warning