fixed bug with negative thermal energy