Fixed seg fault with returning null values