Fix looping issue in #227