Take care of err != nil

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>