Update and fix bugs