Major fixes

Signed-off-by: Bogdan Dobrelya <bogdando@mail.ru>