trying to blindly fix this mess, app still pretty broken, PHP+FTP is such a PITA