repaired class constructor