Based on a patch by Sergiy <piratfm@gmail.com> SVN-Revision: 27809
SVN-Revision: 27399
Based on the patches from #9625 SVN-Revision: 27396