fix constructor call; simplify code