worked on #1251 and #1188 (feel free to test and report it)