Fix random crash

Signed-off-by: Umair Khan <omerjerk@gmail.com>