fixed a few run-time exceptions