Added test covering bug #3151