Fixing code to not to raise exception(#172)