Improve recent crash fix with easier code

(based on commit 6a8b1c8)

Signed-off-by: Xfurry <xfurry@scriptdev2.com>