added tests and fixed queues and event handling

Signed-off-by: unknown <boris@boris-PC2.gspaces.com>