fixed major bug in constructor