fixed database access
a little cleanup
upload now working