using patch from github issues on official branch