fixed small runtime bugs

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