Added exception check to constructors of containers