fixes program ending