Fizes#24. Manually merge with fixes maked by @qnective