Blatent bug fixes and minor changes