Fix bugs from aminh