realtime output fixed. Minior fixes to gpio reading