Added default objects if undefined. This should fix issue #2