Reverted the change in bb09f566, and added a better fix.
Merged changes from origin.