bugfix; tested on pr1040