bug fixes for previous commit by clainatomi