bug fixes- wrongly placed delay caused lag