minor improvements using debug