fix bugs and improve tests