fixed bug, used continue instead of next