Fixing a bug and reordering debug prints

Change-Id: I8777b4ec6eb202982dd5085feca38abc02625b6b
Signed-off-by: TanelDettenborn <tanel.dettenborn@gmail.com>
Merge "Fixing a bug and reordering debug prints"