Fix bugs in object creation.