Clean up environment of devfun

rename the values of the unscaled conditional density as `ucden` and the objective returned as `pdev`

Use the correct logical condition to decide when to write the passed beta into the local environment.