minor bugfixes and workaround to add sprites that are generated by some other script into the generated sprite by this algorithm