Fixed #20 and #22

Signed-off-by: Laentir Valetov <laex@bk.ru>