updates + bug fixes

1. try to prevent buffer overflows
2. minor tweaks