fixing bug with secret logic