added test and issue patch