added test and fixed object creation