better (tested) fix for #15. closes