fixed #539 and also added size() overloader