Fixed a bug in object construction