bug fixes, started to add permissions