fix errors and warnings