Bugfix: Non-null check on the wrong variables