added missing then statement