Fixed bug in constructor