Fixed several bugs...

The `config` decorator should now properly have attributes previously
set on the function it wraps.

Fixed a bug in the pipeline expanding related to state. This caused
incompatible pipelines to be generated.

Added tests cases for previously mentioned bugs.