fix bug, remove unused params
protect debug