Clear unused pointer fields in struct env
Fix compiler warnings for signed/unsigned comparison