Fix template to private method, some debug outputs added