Various fixes and updates for lightning support