Much better fix to #12 implemented