The err_cleanup() funtion is internal so shouldn't be exported