PLD: move basic auth after (before) log and simplify nil check