add some prints and some log to see what is going on