Use wrap to give correct name to mainthread wrapped func. Fixes #2027.