Added patch written by Tobias Ellinghaus (houz)