Various fixes, including #27

Signed-off-by: Poenjabiesous <nielverster@gmail.com>