Modifications to work properly with scaleform

Changed some unsupported syntax and added some little modifications to
avoid leaks.