Fixed queue.
Fixed signed/unsigned.
Fixed bad check before store message.

Signed-off-by: Serg Brych <sbrych@gmail.com>