fixed bug where non-struct pointer causes panic. Make sure code is 100% tested.