Fix #283 infinity loop