fixed issues #10 and #5