minor syntax fixes
some syntax & small bug fixes for internals.py