GNU GPL License
merge upstream changes by Vyacheslav Trushkin