Added patch by Johan Bevemyr (jb@bevemyr.com)