Add regression tests for 3188 and 3265

I'm still in the process of actually running the test-suite, but will let you know when it succeeds.