Added a test for ticket #40, but couldn't reproduce the problem so far. See the ticket for further remarks.