Fixed some bugs in the RPi side