Fix segfault
Fix sizeof reporting pointer's size not array's

Thanks to coverity for finding this.