added debug variable
fixed status calculator