Fixed errors to do with exit().