add debug function
small modifications