fix bugs with code