see comment for line 888