fix bug where new resource wasn't saved properly