A possible solution is to encapsulate the three ugly lines in a single function, containing a comment why it exists.