Print output for debug
Fix some issues