Added internal check for global memory

Signed-off-by: Shahbaz Youssefi <ShabbyX@gmail.com>