some small bugfixes and if statements

Signed-off-by: Alexander Skjolden <alex@plastboks.net>