Fix some problem

Fix an issue with input and output device. If you pass an audio input
info device to an output device it's possible to open but the program
becomes unstable.
And other minor issuse