Fixed error ending early