fixing missing err check