fix loop for parsing options