Fix various issues with go script