Fixed a bug in the constructor