prevent crash due to invalid pointer