Fix logic issue #7