fix bugs from #1