Support for transparent images + fix leaks