fixes and spec tests