added size checks