Fixed ending errors