Fix error reporting
Fix shadowed err preventing failure detection