extra check to avoid accessing invalid memory