Fixes data encoding issues with BaseController.prepare