Fixes for proper marshalling