I've not had your problem but have had magnets come out of the ceiling and stick to the bunk. While fixing that I noticed that the whole bed was a little cattywompus(sp) and I had to add a little 'torque' to one side to make things right. I haven't had trouble since. Could it be that your bunk is not going up all the way (mattress too thick or just out of adjustment) and needs a little tweaking?
2013 Thor 29.2 (HaRVey), interior bike rack, CHF, DIY rear panhard bar, ventilated generator door, 2018 Chevy Spark toad (Sparky)
“It is a mistake to allow any mechanical object to realize that you are in a hurry.”