WIP: start integrating karma, fixed some tests