Here is a tip:
never install more the one mod at a time. Install only one, test the gallery in every possible ways, make sure it works properly, then continue with another mod. Acording to the problems you've had recently, you are installing everything at once and then test it and if something goes wrong you dont know where to look at, because you dont know what modifications could possible caused it.
So, my advice to you is start over and do it the proper way, with backups for each change you make.
I'm not going even bother to guess what possible could be wrong there.
Good luck.