Fixed bugs. WIP.

Signed-off-by: SeynovAM <sejnovalexey@gmail.com>