Fix #393, by adding try catch and log issues