Fixed some bugs
Signed-off-by: Laex <laex@bk.ru>