Some bugfixes

Signed-off-by: dradancer <kuba.zarybnicky@post.cz>