Fix #541, #546