incorporate #1945 to handle #1942