fix bugs variational