Fixed issues reported by ChJohn