Correct NPE
Added some logs