add specs and fix exposed bugs