merge #5311 and #5312 to master