minor bug fixes. (might not be really minor, but I like to say this)