Sounds like you might have intermittent problems with the ribbon cables. The IDC connectors can go dodgy after they've been yanked in and out multiple times.
Replace them with new cables, or just make your own, that way you can get the exact lengths you require. You just need a vice to crimp on the new connectors. Avoid recycling connectors from old cables as they might not provide a reliable connection.