some memory check before accessing