Fixes #1092

Signed-off-by: John Rayes <live627@gmail.com>
Merge pull request #1094 from live627/th

Fixes #1092 and Fixes #1093 as well