fix last_n_resources issue