added conditional to fix image null error