fixed up looping error