fixed a critical error with a class constructor