fixes per suggestions from @amadanmath