fixes #2539

see #2539 for comments