added includes, fixed get_weigts bug

- includes needed for kernel calls
- mod fail, free
- format fix