fixing js error on reading left property of non existing elements