added magicfields middleware