fix check for shared or internal memory