fixed issue when nil value passed for empty check in 'apply' method in permission.rb