I had xperia Z1 and i put a custom cyanogen rom it was fine, but one day error -504 pop-up and then i try to restart the device.. then it stuck's at sony's boot logo.. after that i flashed Resurrection Remix. Everything was fine at that point, i flashed OpenGapps then i install Xposed Framework and the device booted up successfully then i restart the device a couple of time with no problem.. The -504 error pop-up again.. and again the device is stuck at sony's boot logo because i restarted it. Factory reset isn't working nor flashing boot.img. I don't know what to do.. I flashed the same rom a couple of times now i will flash stock.. Is the right decision in this situation?