Fix issues #2088 and #2038