Bug fixes and debug text.

Signed-off-by: bregell <johan_bregell@hotmail.com>