debug print messages and some fix