fixed for bugs and CR notes from #142