Fixed attribute access

Now we serialize to json rather than access attributes directly