Fixs some bugs
Signed-off-by: Yaroslav <yaroslav@itwonline.ru>