fix variable collision
more bug fixes and value logging