Fixes early-exit bug