Fix issues reported by Davide. #357