fixed #-of-elements bug