Added test for issue 4945

See #4945