fixed a bug
added logging
trying fixing