Improvements and bug fixes for ThreadSafeBrickPi

Hello John,
Some small improvements and bug fixes.