fixed dict object has no attribute replace error