When we checked this code in our site it worked .We are trying to add the fix for this in the next update of wplms .
Thanks for sharing your fix .
Perhaps I was wrong to enter the code in the file, I'm not an expert in PHP.
We are fixing this issue in the next update of wplms .