It is very difficult to guess what is causing a problem when provided with insufficient context.
Please provide a working example that demonstrates the problem. Follow these guidelines when writing the example:
use strict and warnings
The example should be runnable with nothing more than copy+paste
Keep the example concise. Cut out any code that is not neccesary to reproduce the error
Additionally, if you are posting an error message that specifies the line on which the error occurred it would be most helpful to tell us which line in your code is producing the error. Line 868 isn't terribly helpful.