partial fix to #1874