Loop protect fixes

- [x] Fixed #1270 
- [x] Fixed #1325
- [x] Fixed #1332 
- [x] Fixed #1335