merged v0.1.7 from  upstream.