Added missing err handling