fix #11 (with bonus fix)