Fix minor errors. Fix #1666