Found the cause of faulty behaviour and fixed it