This fixes a potential use of uninitialized len in subsequent function calls. This was reported by scan-build