Fixed a bug in the add constructor