May be a silly question, but have you tried restarting your s4? I have gotten those errors before and a restart helped. I'm on mj7 stock rooted from old and slow and I get the wifi connection unstable when I'm close to out of range.

Sent from my SCH-I545 using Tapatalk