Fix #846, #834