fixed code according latest changes