Check if objects exists before using them