Better debug and minor fix