bug fix with constructor