Added tests for autoscript module and bugfixes after testing