fixed bug thanks to borovenskis@gmail.com