fixes #12 and #13 - thanks @ffacon !