Fix foreach error when no options are available (#541)