Update fetch script and fix db encoding