check for writepermission