Bug fixes from Richard
added files