correcting problems noted on PR by @mattpap