Add auto detection of ephy 'type' and fixed a few small bugs.