bugfixes

misc bugfixes everywhere. mainly table/map