3-way switch not working properly
This is a guess!!!
This is only a guess. Further investigation is needed to determine how the circuit is wired, and nothing further should be done until you have a complete understanding of the current wiring.
Based on your description, this is how I think it may be wired.

If this is indeed the case, then changing the wiring as follows, should get things working.

Notice I've swapped the black and white wires at Switch 2. I've also swapped the black and white wires from Cable #3, in the first switch box.  Finally, I've marked the white wire from Cable #2 at both ends, to indicate that it is being used as a ungrounded  (hot) conductor.
WARNING!!!
This answer is only a GUESS. You'll have to verify this wiring yourself, before making any changes. Trial-and-error wiring is not safe, and should never be done.
If you need further assistance once you have more information,  please comment on this answer. I will be happy to help you.