foreach if not empty fix