fixes based on @jrrideout's comments