fixed bug in constructor