functions works correctly when called now

functions now work correctly on raspberry pi