fix #12 but still needs to be covered by tests