Bug fixes in embossing algorithm