Fix for testcase described in #544.