Fix null pointer exception issue

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>