Improve implementation of spec stubs