Fix NilClass bug

Issue reported at #19
Fix taken from https://github.com/neilmarion/paano/issues/97