Segmentation error fixed

Signed-off-by: Pornpen Wonganusorn <pornpen.wong@gmail.com>