Check the code and improve logs