BUG: Used continue instead of return to stop foreach returning early