Fixed error in creating object