Fixed infinite loops and NPEs