Added fix for #300 and simple test.