added object checking before printing