Fixed a bug with the abstract factory