many patches from faux123
pwp: adding only near check for pocket wake protection