Fixed loop error
Minor bug fixes