Fix services and compiler to handle __proto

Fixes #548  and #850