Fix added in api context for magic quotes handling. Seems to work. Testing is needed.