I don't think Thomas Richter wrote the ram-handler.
I wrote a test program just now, and got a crash too. However, I found that if the second attempt to lock the record (exclusively) is done with REC_EXCLUSIVE_IMMED, it doesn't crash. Maybe this could be a useful work-around for you.