add serialization
fix global for