add MinSize and MaxSize bound checking