CollectionResource fix for nullpointerexception