fixed import errors and minor bugs