added size check to constructor