this was the main issue. isset is true for the value `false`.
the rest of this PR is mainly small cleanups.