[fix] fixed wrong context usage that caused sigseg
[feature] reorganized the select usage so that programm won't spend 100% in main loop

which will help the power usage