Merge pull request #15 from zoggop/master

migrated from yuri2ba
fix some BA lua errors
fix crash
safety
cleanup / more error checks / safety
merged