fix undefined $size in CLI mode

method returns `return $size;` which is not defined in CLI mode.