add optimized pte permissions checking, more cleanup