Constants fixed

Log now get wirtten properly and some other fixes