Fix for #146

Small fix to explicitly check is element id is null or undefined