Fixed #365.

Just uploaded the patch right now, as I could not provide the test assemblies yet.

Will provide test cases later.