bug fixes

1. handling null H or S or coef
2. type casting for temp_H_S