Fixed an issue with lightning generation