fixed serializer for newer android versions

A simple fix to make serializer compatible with newer android versions.