Added sanity check to prevent an exception