Fix mistakes and add stackTrace() function.