fix entity saving