[fix] compilation warnings
[fix] problem with empty buffer and exit state value on error