Fixed a couple of bugs here and there.