fix bugs and finish populate