Added UGLY casting to avoid gzio compilation warnings... nevertheless it still throwing an error message when executed using valgrind