fix Object.keys called on non object error