prevent crash on invalid data