A little bit better error handling

Signed-off-by: Raphael Lullis <raphael@lullis.net>