fixed some minor bugs and missing imports