Added some waiting to make gdb be able to connect.

A bit strange, but it works and is needed in my Qt creator setup
Added tests and bugfixes

Now I think the tests are complete, and the classes healthy.