fixes bug in object instantiation