fixed some errors, testing on raspberry